//============================================================================
// Copyright (C) 2010 Brett R. Jones
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================
#include "DtwGame.h"

//------------------------------------------------------------------------------
//=== contructor ===//
DtwCamera::DtwCamera( VxIrrBase * poMgr, U32 u32Id, U32 u32OwnerId )
	: VxIrrCamera( poMgr, u32Id, u32OwnerId )
{
	// Set a jump speed of 3 units per second, which gives a fairly realistic jump
	// when used with the gravity of (0, -10, 0) in the collision response animator.
	/*
	m_poCamNode->setPosition(irr::core::vector3df(0,200,0));
	m_poCamNode->setTarget(irr::core::vector3df(0,0,0));
	*/
	//m_poCamNode->setPosition(irr::core::vector3df(0,-200,-400));
	//m_poCamNode->setTarget(irr::core::vector3df(0,0,0));

	//m_poCamNode->setUpVector(irr::core::vector3df(0,-1,0));

	//unfortunately the default irrlicht cam mode is to have the terrain in the x-z plane
	// and look down at the terrain from a -y position instead of the terrain being in the x-y plane like one would expect
	// we want the comets to appear to get smaller as they approach the earth so we need to place the
	// cam in a -y -x position

	// terrain coords when looking down from +y position
	//         N -x
	//          |
	//          |
	// W -z --------- E +z
	//          |\
	//          | \
	//         S +x\
	//             cam +x +y
	/*
	m_poCamNode = m_poMgr->m_poSceneMgr->addCameraSceneNode(0, // parent
						irr::core::vector3df(100,200,0), // position
						irr::core::vector3df(0,0,0)); 	// look at
	m_poCamNode->setFarValue( 1000.0f );
	m_poCamNode->setNearValue( 1.0f );
	m_poMgr->m_poSceneMgr->setActiveCamera(m_poCamNode );
	*/
	//m_poCamNode->setDebugName( "VxIrrCamera" );
};
//------------------------------------------------------------------------------
//! set size of screen
void DtwCamera::SetScreenSize( int iScnSizeX, int iScnSizeY )
{
	VxIrrCamera::SetScreenSize( iScnSizeX, iScnSizeY );
	// to make appox the same amount of world visible despite different
	// screen sizes, move cam away or closer
//	float f32RatioX = (480.0f/(float)iScnSizeX);
//	float f32RatioY = (854.0f/(float)iScnSizeY);
//	m_poCamNode->setPosition( irr::core::vector3df( -180.0f * f32RatioY, 200.0f * f32RatioX, 0.0f));

}
